package com.basics.channel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.basics.channel.entity.CyChannelCommentPrise;
import com.basics.channel.mapper.CyChannelCommentPriseMapper;
import com.basics.channel.service.CyChannelCommentPriseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 评论点赞表 服务实现类
 * </p>
 *
 * @author WangWei
 * @since 2025-03-09
 */
@Service
public class CyChannelCommentPriseServiceImpl extends ServiceImpl<CyChannelCommentPriseMapper, CyChannelCommentPrise> implements CyChannelCommentPriseService {

    @Override
    public boolean checkHasPrise(Long userId, String commentId){
        return count(new QueryWrapper<CyChannelCommentPrise>().eq("user_id",userId).eq("comment_id",commentId))>0;
    }

    @Override
    public int getPriseNum(String commentId){
        return count(new QueryWrapper<CyChannelCommentPrise>().eq("comment_id",commentId));
    }
}
